{template '_header'}

<div class="page-heading"> 
	<span class="pull-right">
		{ifp 'postera.add'}
		<a class='btn btn-primary btn-sm' href="{php echo webUrl('postera/add')}"><i class="fa fa-plus"></i> 添加海报</a>
		{/if}
		{ifp 'postera.clear'}
		<button class="btn btn-danger btn-sm" type="button" data-toggle='ajaxPost' data-confirm="确认要清空缓存?" data-href="{php echo webUrl('postera/clear')}"><i class='fa fa-trash'></i> 清除当前公众号海报缓存</button>
		{/if}	
	</span>
	<h2>海报管理 <small>总数: {$total}</small></h2> 
</div>

<form action="./index.php" method="get" class="form-horizontal" role="form">
	<input type="hidden" name="c" value="site" />
	<input type="hidden" name="a" value="entry" />
	<input type="hidden" name="m" value="ewei_shopv2" />
	<input type="hidden" name="do" value="web" />
	<input type="hidden" name="r"  value="postera" />

	<div class="page-toolbar row m-b-sm m-t-sm">
		<div class="col-sm-4">

			<div class="input-group-btn">
				<button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>

				{ifp 'postera.delete'}	
				<button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('postera/delete')}"><i class='fa fa-trash'></i> 删除</button>
				{/if}


			</div> 
		</div>	


		<div class="col-sm-6 pull-right">

			<select name="type" class='form-control input-sm select-sm'>
				<option value="" {if $_GPC['type'] == ''} selected{/if}>类型</option>
				<option value="1" {if $_GPC['type'] == '1'} selected{/if}>商城</option>
				<option value="2" {if $_GPC['type'] == '2'} selected{/if}>小店</option>
				<option value="3" {if $_GPC['type'] == '3'} selected{/if}>商品</option>
				<option value="4" {if $_GPC['type'] == '4'} selected{/if}>自定义</option>
			</select>	
			<div class="input-group">				 
				<input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="请输入关键词"> <span class="input-group-btn">

					<button class="btn btn-sm btn-primary" type="submit"> 搜索</button> </span>
			</div>

		</div>
	</div>
</form>

{if count($list)>0}

<form action="" method="post" >


	<table class="table table-hover table-responsive">
		<thead>
			<tr>

				<th style="width:25px;"><input type='checkbox' /></th>
				<th  style='width:150px;'>海报名称</th>
				<th style='width:80px;'>关键词</th>
				<th style='width:80px;'>海报类型</th>
				<th  style='width:80px;'>关注数</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			{loop $list $row}
			<tr>
				<td>
					<input type='checkbox'   value="{$row['id']}"/>
				</td>
				<td>{$row['title']}</td>
				<td>{$row['keyword2']}</td>
				<td>
					{if $row['type']==1}
					<label class='label label-primary'>商城</label>
					{elseif $row['type']==2}
					<label class='label label-success'>小店</label>
					{elseif $row['type']==3}
					<label class='label label-warning'>商品</label>
					{elseif $row['type']==4}
					<label class='label label-danger'>自定义</label>

					{/if}
				</td>
				<td>{$row['follows']}</td>

				<td>
					{ifp 'postera.log'}
					<a class='btn btn-default btn-sm' href="{php echo webUrl('postera/log', array('id' => $row['id']))}"><i class='fa fa-qrcode'></i> 关注记录</a>
					{/if}

					{ifp 'postera.edit|postera.view'}
						<a class='btn btn-default btn-sm' href="{php echo webUrl('postera/edit', array( 'id' => $row['id']))}"><i class='fa fa-edit'></i> {ifp 'postera.edit'}编辑{else}查看{/if}</a>
					{/if}
					{if $row['isdefault']==0}
					{ifp 'postera.setdefault'}<a class='btn btn-default btn-sm' data-toggle='ajaxPost' href="{php echo webUrl('postera/setdefault', array('id' => $row['id']))}" data-confirm="确认设置此海报为默认海报吗？"><i class='fa fa-check'></i> 默认</a>{/if}
					{/if}
					{ifp 'postera.delete'}<a class='btn btn-default btn-sm' data-toggle="ajaxRemove"  href="{php echo webUrl('postera/delete', array('id' => $row['id']))}"  title='删除' data-confirm="确认删除此海报吗？"><i class='fa fa-trash'></i> 删除</a></td>{/if}


			</tr>
			{/loop}
		</tbody>
	</table>
	{$pager}    
	{else}
	<div class='panel panel-default'>
		<div class='panel-body' style='text-align: center;padding:30px;'>
			暂时没有任何海报!
		</div>
	</div>
	{/if}
</form> 

{template '_footer'}
